#include "cPlayer.h"

cPlayer::cPlayer(Vector3D position, bool bIsOnScreen)
{
	//Initialize the values of the position
	m_position				= position;

	m_center				= Vector3D(32.0f, 32.0f, 0.0f);

	m_velocity				= Vector3D();

	m_orientation			= 0.00f;

	//Initialize the value of screen presence
	m_bIsOnScreen			= bIsOnScreen;

	//Test for if the player can move
	m_bCanMove				= true;
	m_bMoveLeft				= true;
	m_bMoveRight			= true;
	m_bMoveDown				= true;
	m_bMoveUp				= true;

	//Test for if the player is collidable
	m_bIsCollidable			= true;
	
	//Test for if the player able to shoot
	m_bCanShoot				= true;

	//Controls the player inventory of items
	m_inventory				= new cInventorySystem();

	//Bounding information
	m_bound.center			= m_position;
	m_bound.radius			= Vector3D(16.0f, 16.0f, 0.0f);

	//Initialize Player Stats
	m_stats.health			= 100;
	m_stats.mana			= 100;
	m_stats.strength		= 18;
	m_stats.defense			= 12;
	m_stats.resistance		= 0.01f;
	m_stats.fire_resistance = 0.01f;
	m_stats.ice_resistance	= 0.01f;
	m_stats.holy_resistance	= 0.01f;
	m_stats.dark_resistance = 0.01f;
}

cPlayer::~cPlayer()
{
	delete m_inventory;
}

void cPlayer::updatePlayer()
{
	//Check to see if the bound box is equal to the player position
	m_bound.center	= m_position;

	//Check to see if the player cannot shoot
	if(!m_bCanShoot)
	{
		//Set the value of can shoot to true
		m_bCanShoot = true;
	}
}

cProjectile* cPlayer::fireProjectile()
{
	if(m_bCanShoot)
	{
		//Change the state of fire
		m_bCanShoot = false;

		//Returns an projectile object to be stored into a list
		return new cProjectile();
	}

	//Add the projectile to the list
	return NULL;
}